package com.blkj.framework.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 北浪 2021/11/18
 */

@Data
@Component
@ConfigurationProperties(prefix = "auth")
public class AuthPropertiesConfig {

    private String urlPatterns;

    private String excludes;

    public boolean isMatch(HttpServletRequest request){
        String uri = request.getRequestURI();

        //拦截所有/admin请求
        if (uri.contains("/admin")){
            /**
             * 非登陆请求
             */
            return !uri.contains("/login") && !uri.contains("/logout");
        }
        return false;
    }
}
